package com.shujia.java.day19.demo4;

public class Test {
    public static void main(String[] args) {
        //创建共享资源
        MyRunnable myRunnable = new MyRunnable();
        //创建线程
        Thread thread = new Thread(myRunnable,"张三");
        Thread thread1 = new Thread(myRunnable,"李四");
        Thread thread2 = new Thread(myRunnable,"王五");
        //这个时候 抢票无序的 想让他有序 加sleep
        //加了之后解决了无序问题 但是出现了同一张票买了多次问题
        thread.start();
        thread1.start();
        thread2.start();

    }
}
